import request from "../utils/request.js";

export const LoginApi =({username,password})=>{
    return request({
        url:"/login/",
        method: "post",
        data: {
            username,
            password
        }
    })
}
export const registerApi =({username,password,email})=>{
    return request({
        url:"/user/",
        method: "post",
        data: {
            username,
            password,
            email
        }
    })
}
export const getUserListApi =()=>{
    return request({
        url:"/user",
        method: "get",
    })
}
export const getUserApi =(id)=>{
    return request({
        url:`/user/${id}`,
        method: "get",
    })
}
export const searchUserApi =(search)=>{
    return request({
        url:`/user/`,
        method: "get",
        params: {
           search
        }
    })
}
export const updateUserApi =({username,email,id})=>{
    return request({
        url:`/user/${id}`,
        method: "put",
        data: {
            username,
            email
        }
    })
}
export const deleteUserApi =(id)=>{
    return request({
        url:`/user/${id}`,
        method: "delete",
    })
}

